package config

import (
	"gitee.com/mkwchecking/sr-core/log/ilog"
	"gitee.com/mkwchecking/sr-core/mq"
	"gitee.com/mkwchecking/sr-core/net/http"
	"gitee.com/mkwchecking/sr-core/plugins/es"
	"gitee.com/mkwchecking/sr-core/registry"

	"gitee.com/mkwchecking/sr-core/storage/cache"
	"gitee.com/mkwchecking/sr-core/storage/database/driver"
)

type Config struct {
	AutoInit    bool             `json:"autoInit"`      // 是否自动初始化子组件(数据库、缓存、日志、http server、消息队列、服务发现等组件在配置加载后是否自动初始化)
	Application *Application     `json:"application"`   // 应用配置
	Database    *driver.Config   `json:"database"`      // 数据库配置
	Cache       *cache.Config    `json:"cache"`         // 缓存配置
	Log         *ilog.Config     `json:"log"`           // 日志配置
	HttpServer  *http.HttpConfig `json:"httpServer"`    // http server配置
	MQ          *mq.Config       `json:"mq"`            // 消息队列配置
	Discovery   *registry.Config `json:"discovery"`     // 服务发现配置
	ES          *es.Config       `json:"elasticsearch"` // es配置
}

var _instance = &Config{
	Application: defaultAppcfg(),
}

func Get() *Config { return _instance }
